package com.kfm.bootmybatis.service.impl;

import com.github.pagehelper.PageHelper;
import com.kfm.bootmybatis.dao.IUserDao;
import com.kfm.bootmybatis.model.UserModel;
import com.kfm.bootmybatis.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserDao userDao;

    @Override
    public UserModel login(UserModel userModel) {
        // TODO 测试分页插件
        PageHelper.startPage(1, 1);
        List<UserModel> userModels = userDao.selectByUserModel(userModel);

        return userModels.size() > 0 ? userModels.get(0) : null;
    }
}
